package com.liam.design.proxy.dynamic;

import com.liam.design.proxy.Person;
import com.liam.design.proxy.Student;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class DynamicProxyTest {

    public static void main(String[] args) {
        Person person = new Student("liam");

        InvocationHandler studentHandler = new StudentInvocationHandler<Person>(person);

        Person studentProxy = (Person) Proxy.newProxyInstance(Person.class.getClassLoader(),new Class<?>[]{Person.class},studentHandler);

        studentProxy.giveTask();
    }
}
